
<!DOCTYPE html>
<html>
<body>

<p>本例使用 addEventListener() 方法将两个 click 事件添加到同一个按钮。但是，stopImmediatePropagation() 方法<b>停止了</b>第二个事件处理程序的执行。</p>

<p><b>注释：</b>IE8 及更早版本不支持 stopImmediatePropagation() 方法。</p>
<div id="container">
    <button id="myBtn">试一试</button>
</div>

<script>
function myFunction(event) {
  alert ("Hello World!");
//   event.stopImmediatePropagation(); // Try to remove me
//   event.stopPropagation() 
}

function someOtherFunction() {
  alert ("I will not get to say Hello World");
}
function otherFunction() {
  alert ("ni nihao");
}


var x = document.getElementById("myBtn");
var c = document.getElementById("container");
c.addEventListener('click',otherFunction,true)
x.addEventListener("click", myFunction,true);
x.addEventListener("click", someOtherFunction,true); //决定顺序

</script>
</body>
</html>
